// 引入发送请求的函数对象
import request from "@/utils/request"

// 引入type关键字
import type { TrademarkListDataModel, TrademarkModel } from "./model/trademark"

// 添加枚举,同意管理接口
enum Api {
  // 获取品牌
  getAllTrademarkListApi = "/admin/product/baseTrademark",
  // 添加品牌
  saveTrademarkApi = "/admin/product/baseTrademark/save",
  // 删除品牌
  removeTrademark = "/admin/product/baseTrademark/remove",
  // 修改品牌
  updateTrademarkApi = "/admin/product/baseTrademark/update",
}

// 获取品牌管理数据
export const reqGetTrademarkList = (page: number, limit: number) => {
  return request.get<any, TrademarkListDataModel>(
    // `/admin/product/baseTrademark/${page}/${limit}`
    `${Api.getAllTrademarkListApi}/${page}/${limit}`
  )
}

// 添加品牌
export const reqSaveTrademarkInfo = (trademark: TrademarkModel) => {
  return request.post<any, null>(Api.saveTrademarkApi, trademark)
}

// 删除品牌
export const reqDelTrademarkList = (id: number) => {
  return request.delete<any, null>(`${Api.removeTrademark}/${id}`)
}
// 修改品牌
export const reqUpdateTrademarkInfo = (trademark: TrademarkModel) => {
  return request.put<any, null>(Api.updateTrademarkApi, trademark)
}
